#version 150

in vec3 iVertex;
in vec4 iColor;
in vec3 iNormal;
in vec2 iTexCoord;

uniform mat4 uMVPMatrix;
uniform mat4 uMVMatrix;

out vec4 vColor;
out vec2 vTexCoord;

void main()
{
    vec3 lNorm=vec3(uMVMatrix*vec4(iNormal,0));
    lNorm=normalize(lNorm);
    float lIntensity=dot(lNorm,vec3(0,0,1));

    vColor=vec4(lIntensity*iColor.rgb,iColor.a);
    gl_Position=uMVPMatrix*vec4(iVertex,1.0);
    vTexCoord=iTexCoord;
}
